<?php
/**
 * Created by PhpStorm.
 * User: Liu
 * Date: 2022/11/21
 * Time: 15:14
 */

namespace app\admin\model;

use think\Model;

class Forbidden extends Model {
    protected $insert = ['start','end','status','create_time','update_time'];
    protected $update = ['start','end','status','update_time'];

    protected function setStartAttr($value){
        return ip2long($value);
    }

    protected function setEndAttr($value){
        return ip2long($value);
    }

    protected function setStatusAttr($value){
        return empty($value) ? 0 : 1;
    }

    protected function setIsRecommendedAttr($value){
        return empty($value) ? 0 : 1;
    }

    protected function setUpdateTimeAttr(){
        return time();
    }
}